package com.aihuishou.listener;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageExt;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @Author Zhang Jintao
 * @Date 2021/3/20 15:24
 * @Version 1.0
 */
@Slf4j
@Component
@RocketMQMessageListener(topic = "queue_test",consumerGroup = "consumer_test")
public class MessageListener implements RocketMQListener<MessageExt> {
    @Override
    public void onMessage(MessageExt message) {
        String msg = new String(message.getBody());
        log.info("收到的消息：{}", msg);
    }
}
